import Cookies from "js-cookie";
import client from "./client";

export function LOGIN(data) {
  return client({
    url: "/vblog/api/v1/user/login",
    method: "post",
    // auth为baseauth参数
    auth: { username: data.name, password: data.pass },
  });
}

export function LOGOUT() {
  const username = Cookies.get("username");
  Cookies.remove("username");
  return client({
    url: "/vblog/api/v1/user/logout",
    method: "post",
    // data为body参数
    data: { username },
  });
}
